package cn.tedu.micro.demo.device.service;

import cn.tedu.micro.demo.common.pojo.po.GunInfoPO;
import cn.tedu.micro.demo.common.pojo.vo.GunInfoVO;
import cn.tedu.micro.demo.device.repository.GunRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class GunServiceImpl implements GunService{
    @Autowired
    private GunRepository gunRepository;

    @Override
    public GunInfoVO detail(Long gunId) {
        log.info("查询充电枪详情入参，枪支ID：{}",gunId);
        GunInfoPO po = gunRepository.getGunInfo(gunId);
        GunInfoVO vo = null;
        if (po != null) {
            log.info("查询充电枪详情po：{}",po);
            vo = new GunInfoVO();
            BeanUtils.copyProperties(po,vo);
        }
        log.info("查询充电枪详情出参：{}",vo);
        return vo;
    }
}
